package com.pig4cloud.pig.village.family.controller;

import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.village.api.dto.FamilySelect;
import com.pig4cloud.pig.village.family.service.IFamilyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author limbray.li
 * @date 2021/6/26
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/family")
@Api(value = "family", tags = "家庭-户")
public class FamilyController {
	@Resource
	private IFamilyService familyService;

	@ApiOperation(value = "查询全部家庭-all")
	@GetMapping("/listFamilyAllSelect")
	public R<List<FamilySelect>> listFamilyAllSelect() {
		return R.ok(familyService.listAllSelect());
	}

	@ApiOperation(value = "查询全部家庭-by 组id")
	@GetMapping("/listFamilyByTeamIdSelect")
	public R<List<FamilySelect>> listFamilyByTeamIdSelect(Long teamId) {
		return R.ok(familyService.listByTeamIdSelect(teamId));
	}
}
